<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div:not(#app){
            padding: 50px;
        }
        #div1{
            background:#fc7;
        }
        #div2{
            background:rgb(112, 141, 66);
        }
        #div3{
            background:rgb(124, 153, 190);
        }
    </style>
</head>
<body>
    <div id="app">
      <a @click.prevent="fn1" href="http://www.baidu.com">百度一下</a>
      <button @click.once="fn2">按钮</button>
    </div>
    <script src="./vue.js"></script>
    <script>
        const vm = new Vue({
            el:"#app",
            data:{},
            methods:{
                fn1(){
                    console.log(1);
                },
                fn2(){
                    alert(2)
                }
            }
        })
    </script>
</body>
</html>